<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<!DOCTYPE html>
<html>
<c:set value="${pageContext.request.contextPath }" var="cPath" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
  function codeAddress() {
   var geocoder = new google.maps.Geocoder();
   
    var address = document.getElementById("address").value;
    geocoder.geocode( { 'address': address}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
        //alert(results[0].geometry.location.lat());
        //alert(results[0].geometry.location.lng());
        document.getElementById("lat").value = results[0].geometry.location.lat();
        document.getElementById("lng").value = results[0].geometry.location.lng();
      } else {
        alert("Geocode was not successful for the following reason: " + status);
      }
    });
  }
</script>
</head>
<body>
<div align="center">
<form action="${cPath }/shopInsert.do" 
	method="post" enctype="multipart/form-data">
<table>
	<tr>
		<th>상점이름</th>
		<td>
			<INPUT type="text" name="sh_name" value="${sh_name }"/>
		</td>
	</tr>
	<tr>
		<th>상점전화번호</th>
		<td>
			<INPUT type="text" name="sh_phone" value="${sh_phone }"/>
		</td>
	</tr>
	<tr>
		<th>상점주소</th>
		<td>
			<INPUT type="text" name="sh_add" id="address" value="${sh_add }" />
			<input type="button" value="주소등록" onclick="codeAddress()"/>
		</td>
	</tr>
	<tr>
		<th>상점메세지</th>
		<td>
			<input type="text" name="sh_message" value="${sh_message }"/>
		</td>
	</tr>
	<tr>
		<th>상점사진</th>
		<td>
			<input type="file" name="sh_photo" value="${sh_photo }"/>
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<input type="submit" value="수정하기"/>
		</td>
	</tr>
</table>
<input id="lat" type="text" name="sh_latitude">
<input id="lng" type="text" name="sh_longitude">
</form>
</div>
</body>
</html>